package com.qianguo.shop.entity.mock;

import com.qianguo.shop.entity.Message;
import com.qianguo.shop.entity.MessageList;

import java.util.Random;

/**
 * Created by Forcs on 15/11/29.
 */
public class MockMessageList extends MessageList {

    private Message[] mMessages = null;
    private int mContactId;

    public MockMessageList(int contactId) {
        final int n = 50;
        mMessages = new Message[n];
        for (int i = 0; i < n; i++) {
            if (new Random().nextBoolean()) {
                mMessages[i] = new MockMyMessage(contactId, i);
            } else {
                mMessages[i] = new MockOtherMessage(contactId, i);
            }
        }
        mContactId = contactId;
    }

    @Override
    public int getContactId() {
        return mContactId;
    }

    @Override
    public int getItemCount() {
        return mMessages.length;
    }

    @Override
    public Message getItemAt(int position) {
        return mMessages[position];
    }
}
